﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using EZCRS.HCMS.Data;

namespace EZCRS.HCMS.SqlClient
{
    public class sql_Common
    {
        public DataTable GetLogType()
        {
            //缓存

            string SqlStr = "select lid as tid,lcname as tname from hfg_syslog_code";

            return ExecSql.GetDataSet(SqlStr).Tables[0];

        }

        public bool SaveLog(int LogType, string LogComment, string HotelId, string GroupId, string UserId, string Ip)
        {
            if (ExecSql.SqlExecNoquery("insert into hfg_syslogs(pid,gid,loguser,logip,logtype,logcomment) values(" + HotelId + "," + GroupId + "," + UserId + ",'" + Ip + "'," + LogType.ToString() + ",'" + LogComment + "')") > 0)
                return true;
            else
                return false;
        }

        public bool SaveLog(string UserId, string HotelId, string GroupId, int LogType, string LogComment,string Ip)
        {
            int i = 0;
            if (ExecSql.SqlExecNoquery("insert into hfg_syslogs(pid,gid,loguser,logip,logtype,logcomment) values(" + HotelId + "," + GroupId + "," + UserId + ",'" + Ip + "'," + LogType.ToString() + ",'" + LogComment + "')") > 0)
                return true;
            else
                return false;
        }

        public DataTable CompanyType()
        {
                return ExecSql.GetDataSet("select * from hfg_base_btype order by typrank ").Tables[0];
        }
    }
}
